{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {
    "collapsed": true
   },
   "source": [
    "# 共享单车--线性回归分析\n",
    "在这个案例中，我们将利用Capital Bikeshare（美国Washington, D.C.的一个共享单车公司）提供的自行车数据训练和测试一个模型，\n",
    "并对模型的性能和预测能力进行测试。训练数据为2011年的数据，要求预测2012年每天的单车共享数量。原始数据集为csv格式。"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 1、导入必要的工具包"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 46,
   "metadata": {},
   "outputs": [],
   "source": [
    "import numpy as np  # 矩阵操作\n",
    "import pandas as pd # SQL数据处理 \n",
    "\n",
    "from sklearn.metrics import r2_score    #评价回归预测模型的性能\n",
    "\n",
    "import matplotlib.pyplot as plt     #画图\n",
    "import seaborn as sns\n",
    "\n",
    "# 图形出现在Notebook里而不是新窗口\n",
    "%matplotlib inline"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 2、数据探索"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 2.1 读取数据"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 47,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>instant</th>\n",
       "      <th>dteday</th>\n",
       "      <th>season</th>\n",
       "      <th>yr</th>\n",
       "      <th>mnth</th>\n",
       "      <th>holiday</th>\n",
       "      <th>weekday</th>\n",
       "      <th>workingday</th>\n",
       "      <th>weathersit</th>\n",
       "      <th>temp</th>\n",
       "      <th>atemp</th>\n",
       "      <th>hum</th>\n",
       "      <th>windspeed</th>\n",
       "      <th>casual</th>\n",
       "      <th>registered</th>\n",
       "      <th>cnt</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>1</td>\n",
       "      <td>2011-01-01</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>6</td>\n",
       "      <td>0</td>\n",
       "      <td>2</td>\n",
       "      <td>0.344167</td>\n",
       "      <td>0.363625</td>\n",
       "      <td>0.805833</td>\n",
       "      <td>0.160446</td>\n",
       "      <td>331</td>\n",
       "      <td>654</td>\n",
       "      <td>985</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>2</td>\n",
       "      <td>2011-01-02</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>2</td>\n",
       "      <td>0.363478</td>\n",
       "      <td>0.353739</td>\n",
       "      <td>0.696087</td>\n",
       "      <td>0.248539</td>\n",
       "      <td>131</td>\n",
       "      <td>670</td>\n",
       "      <td>801</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>3</td>\n",
       "      <td>2011-01-03</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>0.196364</td>\n",
       "      <td>0.189405</td>\n",
       "      <td>0.437273</td>\n",
       "      <td>0.248309</td>\n",
       "      <td>120</td>\n",
       "      <td>1229</td>\n",
       "      <td>1349</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>4</td>\n",
       "      <td>2011-01-04</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>2</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>0.200000</td>\n",
       "      <td>0.212122</td>\n",
       "      <td>0.590435</td>\n",
       "      <td>0.160296</td>\n",
       "      <td>108</td>\n",
       "      <td>1454</td>\n",
       "      <td>1562</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>5</td>\n",
       "      <td>2011-01-05</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>3</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>0.226957</td>\n",
       "      <td>0.229270</td>\n",
       "      <td>0.436957</td>\n",
       "      <td>0.186900</td>\n",
       "      <td>82</td>\n",
       "      <td>1518</td>\n",
       "      <td>1600</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "   instant      dteday  season  yr  mnth  holiday  weekday  workingday  \\\n",
       "0        1  2011-01-01       1   0     1        0        6           0   \n",
       "1        2  2011-01-02       1   0     1        0        0           0   \n",
       "2        3  2011-01-03       1   0     1        0        1           1   \n",
       "3        4  2011-01-04       1   0     1        0        2           1   \n",
       "4        5  2011-01-05       1   0     1        0        3           1   \n",
       "\n",
       "   weathersit      temp     atemp       hum  windspeed  casual  registered  \\\n",
       "0           2  0.344167  0.363625  0.805833   0.160446     331         654   \n",
       "1           2  0.363478  0.353739  0.696087   0.248539     131         670   \n",
       "2           1  0.196364  0.189405  0.437273   0.248309     120        1229   \n",
       "3           1  0.200000  0.212122  0.590435   0.160296     108        1454   \n",
       "4           1  0.226957  0.229270  0.436957   0.186900      82        1518   \n",
       "\n",
       "    cnt  \n",
       "0   985  \n",
       "1   801  \n",
       "2  1349  \n",
       "3  1562  \n",
       "4  1600  "
      ]
     },
     "execution_count": 47,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "data = pd.read_csv(\"./day.csv\")\n",
    "\n",
    "#通过观察前5行，了解数据每列（特征）的概况\n",
    "data.head()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 2.2 数据基本信息\n",
    "样本数目、特征维数"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "(731, 16)"
      ]
     },
     "execution_count": 4,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "data.shape"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 2.3 数据探索\n",
    "请见另一个文件：FE_CapitalBikeshare.pynb\n",
    "\n",
    "对数据的探索有助于我们在第三步中根据数据的特点选择合适的模型类型"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 2.4 数据准备"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 61,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "y_train_mean=3405.7616438356163\n",
      "y_test_mean=5599.934426229508\n"
     ]
    },
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>season</th>\n",
       "      <th>mnth</th>\n",
       "      <th>holiday</th>\n",
       "      <th>weekday</th>\n",
       "      <th>workingday</th>\n",
       "      <th>weathersit</th>\n",
       "      <th>temp</th>\n",
       "      <th>atemp</th>\n",
       "      <th>hum</th>\n",
       "      <th>windspeed</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>360</th>\n",
       "      <td>1</td>\n",
       "      <td>12</td>\n",
       "      <td>0</td>\n",
       "      <td>2</td>\n",
       "      <td>1</td>\n",
       "      <td>2</td>\n",
       "      <td>0.325000</td>\n",
       "      <td>0.327633</td>\n",
       "      <td>0.762500</td>\n",
       "      <td>0.188450</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>361</th>\n",
       "      <td>1</td>\n",
       "      <td>12</td>\n",
       "      <td>0</td>\n",
       "      <td>3</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>0.299130</td>\n",
       "      <td>0.279974</td>\n",
       "      <td>0.503913</td>\n",
       "      <td>0.293961</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>362</th>\n",
       "      <td>1</td>\n",
       "      <td>12</td>\n",
       "      <td>0</td>\n",
       "      <td>4</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>0.248333</td>\n",
       "      <td>0.263892</td>\n",
       "      <td>0.574167</td>\n",
       "      <td>0.119412</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>363</th>\n",
       "      <td>1</td>\n",
       "      <td>12</td>\n",
       "      <td>0</td>\n",
       "      <td>5</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>0.311667</td>\n",
       "      <td>0.318812</td>\n",
       "      <td>0.636667</td>\n",
       "      <td>0.134337</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>364</th>\n",
       "      <td>1</td>\n",
       "      <td>12</td>\n",
       "      <td>0</td>\n",
       "      <td>6</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0.410000</td>\n",
       "      <td>0.414121</td>\n",
       "      <td>0.615833</td>\n",
       "      <td>0.220154</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "     season  mnth  holiday  weekday  workingday  weathersit      temp  \\\n",
       "360       1    12        0        2           1           2  0.325000   \n",
       "361       1    12        0        3           1           1  0.299130   \n",
       "362       1    12        0        4           1           1  0.248333   \n",
       "363       1    12        0        5           1           1  0.311667   \n",
       "364       1    12        0        6           0           1  0.410000   \n",
       "\n",
       "        atemp       hum  windspeed  \n",
       "360  0.327633  0.762500   0.188450  \n",
       "361  0.279974  0.503913   0.293961  \n",
       "362  0.263892  0.574167   0.119412  \n",
       "363  0.318812  0.636667   0.134337  \n",
       "364  0.414121  0.615833   0.220154  "
      ]
     },
     "execution_count": 61,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 从原始数据中分离输入特征x和输出y\n",
    "y = data['cnt'].values\n",
    "X = data.drop(columns=['instant', 'dteday', 'casual', 'registered', 'cnt'])  \n",
    "# X = data.drop(columns=['season', 'mnth'])\n",
    "# 将矩阵转换为列表的函数：numpy.matrix.tolist（）\n",
    "# 时间元组\n",
    "# 将日期字段转换为对应的一年中的第几天\n",
    "# print(pd.to_datetime(pd.Series(['Jul 31, 2009', '2010-01-10'])).apply(lambda x: x.timetuple().tm_yday))\n",
    "# X['dteday'] = pd.to_datetime(pd.Series(X['dteday'].tolist())).apply(lambda x: x.timetuple().tm_yday) \n",
    "\n",
    "# 分隔训练数据和测试数据 \n",
    "# 训练集\n",
    "X_train = X[X[\"yr\"] == 0].drop(columns=['yr'])  # training set = select rows containing '2011'  (365, 11)\n",
    "y_train = (data[data[\"yr\"] == 0])['cnt'].values # (365,)\n",
    "y_train_mean = np.mean(y_train)  # 计算训练集y标签的均值\n",
    "print('y_train_mean=' + str(y_train_mean))\n",
    "y_train = y_train - y_train_mean  # 更新训练集y标签\n",
    "\n",
    "# 测试集\n",
    "X_test = X[X[\"yr\"] == 1].drop(columns=['yr'])  # test set = select rows containing '2012'  (366, 11)\n",
    "y_test = (data[data[\"yr\"] == 1])['cnt'].values # (366,)\n",
    "y_test_mean = np.mean(y_test)   # 计算测试集y标签的均值\n",
    "print('y_test_mean=' + str(y_test_mean))\n",
    "y_test = y_test - y_test_mean   # 更新测试集y标签\n",
    "\n",
    "# 用于后续显示权重系数对应的特征\n",
    "columns = X_train.columns # (11,)\n",
    "\n",
    "X_train.tail()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 2.5 数据预处理／特征工程\n",
    "\n",
    "特征工程是实际任务中特别重要的环节。\n",
    "\n",
    "scikit learn中提供的数据预处理功能：\n",
    "http://scikit-learn.org/stable/modules/preprocessing.html\n",
    "http://scikit-learn.org/stable/modules/classes.html#module- sklearn.feature_extraction"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "#发现各特征差异较大，需要进行数据标准化预处理\n",
    "#标准化的目的在于避免原始特征值差异过大，导致训练得到的参数权重不归一，无法比较各特征的重要性"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 62,
   "metadata": {},
   "outputs": [],
   "source": [
    "# 数据标准化\n",
    "from sklearn.preprocessing import StandardScaler\n",
    "from sklearn.preprocessing import MinMaxScaler\n",
    "\n",
    "# 分别初始化对特征和目标值的标准化器MinMaxScaler min_max_scaler_X min_max_scaler_y\n",
    "ss_X = StandardScaler()\n",
    "ss_y = StandardScaler()\n",
    "\n",
    "# 分别对训练和测试数据的特征以及目标值进行标准化处理\n",
    "X_train = ss_X.fit_transform(X_train)\n",
    "X_test = ss_X.transform(X_test)\n",
    "\n",
    "#对y做标准化不是必须\n",
    "#对y标准化的好处是不同问题的w差异不太大，同时正则参数的范围也有限\n",
    "y_train = ss_y.fit_transform(y_train.reshape(-1, 1))\n",
    "y_test = ss_y.transform(y_test.reshape(-1, 1))"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 3、确定模型类型"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 3.1 尝试缺省参数的线性回归"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 63,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>coef</th>\n",
       "      <th>columns</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>6</th>\n",
       "      <td>[0.6552364353084575]</td>\n",
       "      <td>temp</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>[0.2951780426792701]</td>\n",
       "      <td>season</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>[0.035332402181452664]</td>\n",
       "      <td>weekday</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>[0.007286281574697547]</td>\n",
       "      <td>workingday</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>[0.003868571561647327]</td>\n",
       "      <td>mnth</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7</th>\n",
       "      <td>[-0.02114072759985118]</td>\n",
       "      <td>atemp</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>[-0.03601989254948204]</td>\n",
       "      <td>holiday</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8</th>\n",
       "      <td>[-0.05942477581033426]</td>\n",
       "      <td>hum</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9</th>\n",
       "      <td>[-0.12391854742331593]</td>\n",
       "      <td>windspeed</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>[-0.2256947758690207]</td>\n",
       "      <td>weathersit</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "                     coef     columns\n",
       "6    [0.6552364353084575]        temp\n",
       "0    [0.2951780426792701]      season\n",
       "3  [0.035332402181452664]     weekday\n",
       "4  [0.007286281574697547]  workingday\n",
       "1  [0.003868571561647327]        mnth\n",
       "7  [-0.02114072759985118]       atemp\n",
       "2  [-0.03601989254948204]     holiday\n",
       "8  [-0.05942477581033426]         hum\n",
       "9  [-0.12391854742331593]   windspeed\n",
       "5   [-0.2256947758690207]  weathersit"
      ]
     },
     "execution_count": 63,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 线性回归\n",
    "#class sklearn.linear_model.LinearRegression(fit_intercept=True, normalize=False, copy_X=True, n_jobs=1)\n",
    "from sklearn.linear_model import LinearRegression\n",
    "\n",
    "# 使用默认配置初始化\n",
    "lr = LinearRegression()\n",
    "\n",
    "# 训练模型参数\n",
    "lr.fit(X_train, y_train)\n",
    "\n",
    "# 预测\n",
    "y_test_pred_lr = lr.predict(X_test)\n",
    "y_train_pred_lr = lr.predict(X_train)\n",
    "\n",
    "\n",
    "# 看看各特征的权重系数，系数的绝对值大小可视为该特征的重要性\n",
    "fs = pd.DataFrame({\"columns\":list(columns), \"coef\":list((lr.coef_.T))})\n",
    "fs.sort_values(by=['coef'],ascending=False)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "#### 3.1.1 模型评价"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 64,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "The r2 score of LinearRegression on test is 0.63660756905241\n",
      "The r2 score of LinearRegression on train is 0.758519666910396\n"
     ]
    }
   ],
   "source": [
    "# 使用r2_score评价模型在测试集和训练集上的性能，并输出评估结果\n",
    "#测试集\n",
    "print('The r2 score of LinearRegression on test is', r2_score(y_test, y_test_pred_lr))\n",
    "#训练集\n",
    "print('The r2 score of LinearRegression on train is', r2_score(y_train, y_train_pred_lr))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 65,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAekAAAFsCAYAAADos0H8AAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDIuMi4yLCBodHRwOi8vbWF0cGxvdGxpYi5vcmcvhp/UCwAAHi5JREFUeJzt3XuUXGWZ7/HvQ9ISh0C4dSAQY0BBuSfYxEQEo1FBQYJrVPQghMUliDLL+yhylBZ11APqkkP0GBUBQbmNCKNyBk8kE+EoTMKEa9BELseEGEKUS1AuaZ7zR+2OnaQ7Xemu7n7T9f2sVaur9t6163lrp/Prd++33orMRJIklWeboS5AkiR1z5CWJKlQhrQkSYUypCVJKpQhLUlSoQxpSZIKZUir6UXEfRExfajrGEoR8c6I+GNErI2IyYP4umsjYu8e1p0SEbc26HUejog3N2Jf0mAypDWsdfef88b/+WfmAZk5v5f9TIyIjIiRA1TqULsQODszR2fmf228smr7M1WoroiIr0fEiP6+aPV6D/Z3P9JwZUhLBSgg/F8O3NfLNodk5mjgDcAJwKkDXpXU5AxpNb2uve2ImBIRCyPiqYhYFRFfrzZbUP18oupNTouIbSLiv0fEIxHxWERcHhFjuuz35Grdmoj47Eav0x4R10XEFRHxFHBK9dq/iYgnImJlRFwcES/psr+MiA9GxNKIeDoivhARr6ie81REXNN1+43a2G2tEbFtRKwFRgB3RcQfenu/MnMZcBswqcv+x0TE96u6V0TEFzt72hHxyoj4j4h4MiIej4irN2rTK6v7u0TEjVVb7gBe0WW7Tc5kRMT8iDi9uv+KiPhV9V4/HhFXRsSOPbwXPR1jqTiGtLShbwLfzMwdqIXENdXyI6ufO1anaH8DnFLd3gjsDYwGLgaIiP2Bb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c8wxHHLIIRx44IFcffXVQK0X2zkF9A9+8AP23Xdf3vCGN3Dbbbet398pp5zCddf9fZqN0aNHA7B27VpmzJjBoYceykEHHcQNN9ywSW0rV67kyCOPZNKkSRx44IH8+te/rqtN8+fP59hjjwWgvb2dU089lenTp7P33ntv0Lu+4oormDJlCpMmTeLMM8+ko6MDgLPOOou2tjYOOOCA9e8B1Ka8Pv/883n961/PtddeW1ct9RrUubslSeXr6Ohg3rx5nHbaaQDcfPPNLF26lDvuuIPM5LjjjmPBggWsXr2aPfbYg5///OcAPPnkkxvsZ+XKlZx33nksWrSIMWPG8MY3vpHJkzc5MbuBUaNGcf3117PDDjvw+OOPM3XqVI477rgNBmD96Ec/4qijjuLcc8+lo6ODv/71r31q5wMPPMAtt9zC008/zate9SrOOussli1bxtVXX81tt91GS0sLH/zgB7nyyis5+eST+dKXvsTOO+9MR0cHM2bM4O677+bggw9eX/ett97apzo2x5CWJAHwt7/9jUmTJvHwww/zmte8hre85S1ALaRvvvnm9QG7du1ali5dyhFHHMEnPvEJPvWpT3HsscdyxBFHbLC/22+/nenTp9P5yZ4TTjiB3//+95utITP5zGc+w4IFC9hmm21YsWIFq1atYvfdd1+/zWGHHcapp57KCy+8wPHHH8+kSX2blfqYY45h2223Zdttt2Xs2LGsWrWKefPmsWjRIg477LD178nYsWMBuOaaa5g7dy7r1q1j5cqV3H///etD+oQTTuhTDb3xdLckCfj7NelHHnmE559/njlz5gC14DznnHNYvHgxixcvZtmyZZx22mnsu+++LFq0iIMOOohzzjmH888/f5N99vQRpJEjR/Liiy+u3//zzz8PwJVXXsnq1atZtGgRixcvZrfddtvkc8ZHHnkkCxYsYM899+Skk07i8ssv71N7t9122/X3R4wYwbp168hMZs2atb6tv/vd72hvb+ehhx7iwgsvZN68edx9990cc8wxG9S13Xbb9amG3tiTljRo6h2x3OiRzdoyY8aM4aKLLmLmzJmcddZZHHXUUXz2s5/lxBNPZPTo0axYsYKWlhbWrVvHzjvvzPvf/35Gjx7NpZdeus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2oyJiYUT8NiK25iCv5ziu36b6o/1JYJdBqW5g1ftv+B+r073XRcTLulk/XA3X3/F6TYuIuyLipog4oLeN+zMt6GZFxP8Bdu9m1bmZeUO1zbnAOuDK7nbRzbKt4vNi9bS9Dodn5qMRMRb4ZUQ8UP2VVrQGtH1YHvct2M2E6rjvDfwqIu7JzD80psJBVc9x3GqPdS/qade/AT/OzOci4gPUzii8acArK8NwPe71uJPanN1rI+LtwE+BfTb3hAEL6cx88+bWR8Qs4FhgRlYn6zey1U472lvb69zHo9XPxyLiemqn0IoP6Qa0fVge94hYFRHjMnNldWrvsR720XncH4yI+cBkatc3tzb1HMfObZZHxEhgDA0+VThEem17Zq7p8vC71MbmNIut9ne8vzLzqS73fxER34qIXTOzxy8dGarR3UcDnwKOy8y/9rBZ0047GhHbRcT2nfepDbTrdrTgMDRcj/uNwKzq/ixgk7MKEbFTRGxb3d8VOBy4f9AqbKx6jmPX9+RdwK96+IN9a9Nr2ze6BnscsGQQ6xtqNwInV6O8pwJPdl4KGu4iYvfOcRcRMYVaBq/Z7JOGaATcMmrXJBZXt84RnnsAv+iy3duB31PrSZw7FLUOQNvfSe0vyeeAVcC/b9x2aqNC76pu9zVT24fxcd8FmAcsrX7uXC1vA75X3X8dcE913O8BThvquvvZ5k2OI3A+tT/OAUYB11b/H9wB7D3UNQ9i279c/W7fBdwCvHqoa25g238MrAReqH7fTwM+AHygWh/AnOq9uYfNfMpla7vV0fazuxz33wKv622fTgsqSVKhShjdLUmSumFIS5JUKENakqRCGdKSJBXKkJYkqVCGtCRJhTKkJUkq1P8H0j0cAMNkbTkAAAAASUVORK5CYII=\n",
      "text/plain": [
       "<Figure size 504x360 with 1 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "#在训练集上观察预测残差的分布，看是否符合模型假设：噪声为0均值的高斯噪声\n",
    "f, ax = plt.subplots(figsize=(7, 5)) \n",
    "f.tight_layout() \n",
    "ax.hist(y_train - y_train_pred_lr,bins=40, label='Residuals Linear', color='b', alpha=.5); \n",
    "ax.set_title(\"Histogram of Residuals\") \n",
    "ax.legend(loc='best');"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "残差分布和高斯分布比较匹配"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 66,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAARgAAADQCAYAAADcQn7hAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDIuMi4yLCBodHRwOi8vbWF0cGxvdGxpYi5vcmcvhp/UCwAAIABJREFUeJztnXl4lOXV/z8nkyELBMKqElFcKFYRZFFBakWrFdwAqyLl9ZVqsbS+7rXiUoVWf2hxL32tCm0Vta7AT6CKC2rdANkpIq3iRkAgQEDINpmc94+Z4CSZ5ZnM8kwm53NduTLzzDPPfTKZ+c59n3Puc0RVMQzDSAU5bhtgGEb2YgJjGEbKMIExDCNlmMAYhpEyTGAMw0gZJjCGYaQMExjDMFKGCYxhGCnDBMYwjJSR67YB8dClSxft2bOn22YYRqtn+fLlZaraNdZ5LUpgevbsybJly9w2wzBaPSLypZPzbIlkGEbKMIExDCNluCYwIpIvIktFZLWIrBORKW7ZYhhGanDTB1MNnKaqe0XEC7wnIq+o6mIXbTIMI4m4NoPRAHuDd73BHytOYxguUFNTk5LruuqDERGPiKwCtgGvq+qSMOdcISLLRGTZ9u3b02+kYWQ5a9asYeDAgTzzzDNJv7arAqOqflU9DjgYOEFE+oQ55zFVHaSqg7p2jRl2NwzDIXV1ddx///0cf/zxlJWV0blz56SPkRFRJFUtB94GhrtsimG0CjZt2sQZZ5zBDTfcwIgRI1izZg1nnnlm0sdxM4rUVUSKg7cLgNOBT9yyxzBaEx999BFLlixhxowZzJkzh1StDtyMIh0EPCEiHgJC97yqznfRHsPIanbv3s0HH3zAiBEjGD16NBs3b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Uhfs+BTIA3YEDy1WVVdKhIrIaOCPQFegHFilqmemcfyzgAcJRJT+oqp3pWvsRnb8HRhGoDTBVuAOVZ3pgh0/AN4F1hJ4nwLcoqr/SLMdfYEnCPxfcoDnVfV3Sbl2tgqMYRjuk7VLJMMw3McExjCMlGECYxhGyjCBMQwjZZjAGIaRMlp0op2RPESkM/Bm8O6BgB/YHrx/QnD/UMYjIp2Ai1T1z27bYliY2giDiEwG9qrqvY2OC4H3TF3YJ2YAInIk8GIw7d1wGVsiGVERkSODe5n+DKwAeohIecjjF4vIjODtA0RktogsC9YXGRzmerki8kDwmmtE5FfB42cEa/esFZHHg9m+iMimkCzTwSLyRvD2nSIyU0TeEZGNInJlcIi7gd7Ba92dytfGiI0tkQwnHA38TFUniki098zDwB9UdXFwd/B8oPGmuV8C3YF+quoXkU4iUgj8BRimqp+JyNPAFcD0GHZ9D/gRUAysD4rgJOBIm8FkBiYwhhM+U9WPHJx3OoHZQ/39jiJSoKqVjc55UFX9AKq6U0QGAv9R1c+C5zwJXE5sgZkf9A1tE5GdBLZAGBmECYzhhH0ht+toWHohP+S2ENshLDQt0xCulEM9tXy3lM9v9Fh1yG0/9n7OOMwHY8RF0MG7S0R6iUgOMDrk4TeAel8IIhJumfIa8EsR8QTP6QR8TGCn9eHBc/4LeCd4+wtgYPD2TxyY+C2B8pNGBmACYzSHm4BXCYS1N4UcvxIYGnTefgxMCPPcR4FvgDUisppASLmCwJJotoisJTAzeTx4/mTgf0XkXSBmqFxVtwLLgs5ic/K6jIWpDcNIGTaDMQwjZZjAGIaRMkxgDMNIGSYwhmGkDBMYwzBShgmMYRgpwwTGMIyU8X/cdZPV4f2mdwAAAABJRU5ErkJggg==\n",
      "text/plain": [
       "<Figure size 288x216 with 1 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "#还可以观察预测值与真值的散点图\n",
    "plt.figure(figsize=(4, 3))\n",
    "plt.scatter(y_train, y_train_pred_lr)\n",
    "plt.plot([-3, 3], [-3, 3], '--k')   #数据已经标准化，3倍标准差即可\n",
    "plt.axis('tight')\n",
    "plt.xlabel('True count')\n",
    "plt.ylabel('Predicted count')\n",
    "plt.tight_layout()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 67,
   "metadata": {},
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "C:\\Python36\\lib\\site-packages\\sklearn\\utils\\validation.py:578: DataConversionWarning: A column-vector y was passed when a 1d array was expected. Please change the shape of y to (n_samples, ), for example using ravel().\n",
      "  y = column_or_1d(y, warn=True)\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "array([ 0.29623475,  0.00149148, -0.03379286,  0.03551151,  0.00730862,\n",
       "       -0.22419283,  0.47460877,  0.16064941, -0.06183064, -0.12096994])"
      ]
     },
     "execution_count": 67,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 线性模型，随机梯度下降优化模型参数\n",
    "# 随机梯度下降一般在大数据集上应用，其实本项目不适合用\n",
    "from sklearn.linear_model import SGDRegressor\n",
    "\n",
    "# 使用默认配置初始化线\n",
    "sgdr = SGDRegressor(max_iter=1000)\n",
    "\n",
    "# 训练：参数估计\n",
    "sgdr.fit(X_train, y_train)\n",
    "\n",
    "# 预测\n",
    "#sgdr_y_predict = sgdr.predict(X_test)\n",
    "\n",
    "sgdr.coef_    # The member coef_ holds the model parameters:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 68,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "The value of default measurement of SGDRegressor on test is 0.638722022349919\n",
      "The value of default measurement of SGDRegressor on train is 0.7583104654998805\n"
     ]
    }
   ],
   "source": [
    "# 使用SGDRegressor模型自带的评估模块(评价准则为r2_score)，并输出评估结果\n",
    "print ('The value of default measurement of SGDRegressor on test is', sgdr.score(X_test, y_test))\n",
    "print ('The value of default measurement of SGDRegressor on train is', sgdr.score(X_train, y_train))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 32,
   "metadata": {},
   "outputs": [],
   "source": [
    "#这里由于样本数不多，SGDRegressor可能不如LinearRegression。 sklearn建议样本数超过10万采用SGDRegressor"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 3.2 正则化的线性回归（L2正则 --> 岭回归）"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 69,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "The r2 score of RidgeCV on test is 0.6346968842940688\n",
      "The r2 score of RidgeCV on train is 0.7576975492426052\n"
     ]
    }
   ],
   "source": [
    "#岭回归／L2正则\n",
    "#class sklearn.linear_model.RidgeCV(alphas=(0.1, 1.0, 10.0), fit_intercept=True, \n",
    "#                                  normalize=False, scoring=None, cv=None, gcv_mode=None, \n",
    "#                                  store_cv_values=False)\n",
    "from sklearn.linear_model import  RidgeCV\n",
    "\n",
    "#设置超参数（正则参数）范围\n",
    "alphas = [ 0.01, 0.1, 1, 10,100]\n",
    "#n_alphas = 20\n",
    "#alphas = np.logspace(-5,2,n_alphas)\n",
    "\n",
    "#生成一个RidgeCV实例\n",
    "ridge = RidgeCV(alphas=alphas, store_cv_values=True)  \n",
    "\n",
    "#模型训练\n",
    "ridge.fit(X_train, y_train)    \n",
    "\n",
    "#预测\n",
    "y_test_pred_ridge = ridge.predict(X_test)\n",
    "y_train_pred_ridge = ridge.predict(X_train)\n",
    "\n",
    "\n",
    "# 评估，使用r2_score评价模型在测试集和训练集上的性能\n",
    "print('The r2 score of RidgeCV on test is', r2_score(y_test, y_test_pred_ridge))\n",
    "print('The r2 score of RidgeCV on train is', r2_score(y_train, y_train_pred_ridge))"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 可视化"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 70,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAZIAAAEKCAYAAAA4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wAAAABJRU5ErkJggg==\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "alpha is: 10.0\n"
     ]
    },
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>coef_lr</th>\n",
       "      <th>coef_ridge</th>\n",
       "      <th>columns</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>6</th>\n",
       "      <td>[0.6552364353084575]</td>\n",
       "      <td>[0.35015384686243833]</td>\n",
       "      <td>temp</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>[0.2951780426792701]</td>\n",
       "      <td>[0.2757654251364401]</td>\n",
       "      <td>season</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>[0.035332402181452664]</td>\n",
       "      <td>[0.033998994978248695]</td>\n",
       "      <td>weekday</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>[0.007286281574697547]</td>\n",
       "      <td>[0.00729342301537915]</td>\n",
       "      <td>workingday</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>[0.003868571561647327]</td>\n",
       "      <td>[0.0188360069554371]</td>\n",
       "      <td>mnth</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7</th>\n",
       "      <td>[-0.02114072759985118]</td>\n",
       "      <td>[0.2804709635627412]</td>\n",
       "      <td>atemp</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>[-0.03601989254948204]</td>\n",
       "      <td>[-0.033641709939015066]</td>\n",
       "      <td>holiday</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8</th>\n",
       "      <td>[-0.05942477581033426]</td>\n",
       "      <td>[-0.06294976734688704]</td>\n",
       "      <td>hum</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9</th>\n",
       "      <td>[-0.12391854742331593]</td>\n",
       "      <td>[-0.11713890245230286]</td>\n",
       "      <td>windspeed</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>[-0.2256947758690207]</td>\n",
       "      <td>[-0.2164268827072586]</td>\n",
       "      <td>weathersit</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "                  coef_lr               coef_ridge     columns\n",
       "6    [0.6552364353084575]    [0.35015384686243833]        temp\n",
       "0    [0.2951780426792701]     [0.2757654251364401]      season\n",
       "3  [0.035332402181452664]   [0.033998994978248695]     weekday\n",
       "4  [0.007286281574697547]    [0.00729342301537915]  workingday\n",
       "1  [0.003868571561647327]     [0.0188360069554371]        mnth\n",
       "7  [-0.02114072759985118]     [0.2804709635627412]       atemp\n",
       "2  [-0.03601989254948204]  [-0.033641709939015066]     holiday\n",
       "8  [-0.05942477581033426]   [-0.06294976734688704]         hum\n",
       "9  [-0.12391854742331593]   [-0.11713890245230286]   windspeed\n",
       "5   [-0.2256947758690207]    [-0.2164268827072586]  weathersit"
      ]
     },
     "execution_count": 70,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "mse_mean = np.mean(ridge.cv_values_, axis = 0)\n",
    "plt.plot(np.log10(alphas), mse_mean.reshape(len(alphas),1)) \n",
    "\n",
    "#这是为了标出最佳参数的位置，不是必须\n",
    "#plt.plot(np.log10(ridge.alpha_)*np.ones(3), [0.28, 0.29, 0.30])\n",
    "\n",
    "plt.xlabel('log(alpha)')\n",
    "plt.ylabel('mse')\n",
    "plt.show()\n",
    "\n",
    "print ('alpha is:', ridge.alpha_)\n",
    "\n",
    "# 看看各特征的权重系数，系数的绝对值大小可视为该特征的重要性\n",
    "fs = pd.DataFrame({\"columns\":list(columns), \"coef_lr\":list((lr.coef_.T)), \"coef_ridge\":list((ridge.coef_.T))})\n",
    "fs.sort_values(by=['coef_lr'],ascending=False)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 3.3 正则化的线性回归（L1正则 --> Lasso）"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 71,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "The r2 score of LassoCV on test is 0.5318856700929785\n",
      "The r2 score of LassoCV on train is 0.6923749133394081\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "C:\\Python36\\lib\\site-packages\\sklearn\\linear_model\\coordinate_descent.py:1094: DataConversionWarning: A column-vector y was passed when a 1d array was expected. Please change the shape of y to (n_samples, ), for example using ravel().\n",
      "  y = column_or_1d(y, warn=True)\n"
     ]
    }
   ],
   "source": [
    "#### Lasso／L1正则\n",
    "# class sklearn.linear_model.LassoCV(eps=0.001, n_alphas=100, alphas=None, fit_intercept=True, \n",
    "#                                    normalize=False, precompute=’auto’, max_iter=1000, \n",
    "#                                    tol=0.0001, copy_X=True, cv=None, verbose=False, n_jobs=1,\n",
    "#                                    positive=False, random_state=None, selection=’cyclic’)\n",
    "from sklearn.linear_model import LassoCV\n",
    "\n",
    "#设置超参数搜索范围\n",
    "#alphas = [ 0.01, 0.1, 1, 10,100]\n",
    "\n",
    "#生成一个LassoCV实例\n",
    "#lasso = LassoCV(alphas=alphas)  \n",
    "lasso = LassoCV()  \n",
    "\n",
    "#训练（内含CV）\n",
    "lasso.fit(X_train, y_train)  \n",
    "\n",
    "#测试\n",
    "y_test_pred_lasso = lasso.predict(X_test)\n",
    "y_train_pred_lasso = lasso.predict(X_train)\n",
    "\n",
    "\n",
    "# 评估，使用r2_score评价模型在测试集和训练集上的性能\n",
    "print ('The r2 score of LassoCV on test is', r2_score(y_test, y_test_pred_lasso))\n",
    "print ('The r2 score of LassoCV on train is', r2_score(y_train, y_train_pred_lasso))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 72,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAYYAAAEKCAYAAAAW8vJGAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDIuMi4yLCBodHRwOi8vbWF0cGxvdGxpYi5vcmcvhp/UCwAAIABJREFUeJzt3Xl8VfWd//HXJ/seCFnYSVhlRwiggorWsWir1hWp497x59h2poud6rRTZ9rpY8ZqnVatVaoMalurtW7tuC+IIqgBkUUIhD1AyELIHrLc7++Pe8EEs9xAbs5N8n4+HvfBTc43535OLsk753y/5/s15xwiIiJHRXhdgIiIhBcFg4iItKJgEBGRVhQMIiLSioJBRERaUTCIiEgrCgYREWklZMFgZkvNrNjMNraz/Qdmti7w2GhmzWaWFqp6REQkOBaqG9zM7CygGnjCOTelk7YXAd91zp0bkmJERCRoUaHasXNuhZllB9l8MfBUMA3T09NddnawuxUREYA1a9aUOucygmkbsmAIlpklAAuBb3XQ5hbgFoCRI0eSl5fXQ9WJiPQNZrY72Lbh0Pl8EbDSOXeovQbOuSXOuVznXG5GRlCBJyIiJygcguFqgryMJCIioedpMJhZKnA28KKXdYiIyOdC1sdgZk8BC4B0MysE7gKiAZxzDweaXQq87pyrCVUdIiLSNaEclbQ4iDbLgGWhqkFERLouHPoYREQkjCgYRESkFQWDiEiYK60+wpIV21m1vaxHXs/zG9xEROSLfD7Hu9tKePqjvby5+SBNPsetZ4/h9DGDQv7aCgYRkTBSfaSJv6wp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dyQVOBA4Y7kW/7KNR42n986yKr2MzhikP3oef//Bp/j/iv8X51yRmf0F+BL+X8BbgQ/xr3YF/rU5FgBvOuc+NbNP8M9+ugNY2c7r1ACTzWxNYD+LOqnrIeAvZnYl8E7g6486J1CDSMhpdlWRFswsyTlXbWaD8J9FzAuERjz+X9bzAn0Tweyr2jmX1E11rQAucf51xkVCSmcMIq39zcwGADHAz5xzRQDOuTozuwv/+rl7erKgwOWu+xQK0lN0xiAiIq2o81lERFpRMIiISCsKBhERaUXBICIirSgYRESkFQWDiIi08v8BHNTL5RevyUUAAAAASUVORK5CYII=\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "alpha is: 0.14527588617252232\n"
     ]
    },
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>coef_lasso</th>\n",
       "      <th>coef_lr</th>\n",
       "      <th>coef_ridge</th>\n",
       "      <th>columns</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>6</th>\n",
       "      <td>0.067640</td>\n",
       "      <td>[0.6552364353084575]</td>\n",
       "      <td>[0.35015384686243833]</td>\n",
       "      <td>temp</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>0.193429</td>\n",
       "      <td>[0.2951780426792701]</td>\n",
       "      <td>[0.2757654251364401]</td>\n",
       "      <td>season</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>0.000000</td>\n",
       "      <td>[0.035332402181452664]</td>\n",
       "      <td>[0.033998994978248695]</td>\n",
       "      <td>weekday</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>0.000000</td>\n",
       "      <td>[0.007286281574697547]</td>\n",
       "      <td>[0.00729342301537915]</td>\n",
       "      <td>workingday</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>0.000000</td>\n",
       "      <td>[0.003868571561647327]</td>\n",
       "      <td>[0.0188360069554371]</td>\n",
       "      <td>mnth</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7</th>\n",
       "      <td>0.476180</td>\n",
       "      <td>[-0.02114072759985118]</td>\n",
       "      <td>[0.2804709635627412]</td>\n",
       "      <td>atemp</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>-0.000000</td>\n",
       "      <td>[-0.03601989254948204]</td>\n",
       "      <td>[-0.033641709939015066]</td>\n",
       "      <td>holiday</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8</th>\n",
       "      <td>-0.000000</td>\n",
       "      <td>[-0.05942477581033426]</td>\n",
       "      <td>[-0.06294976734688704]</td>\n",
       "      <td>hum</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9</th>\n",
       "      <td>-0.000000</td>\n",
       "      <td>[-0.12391854742331593]</td>\n",
       "      <td>[-0.11713890245230286]</td>\n",
       "      <td>windspeed</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>-0.127561</td>\n",
       "      <td>[-0.2256947758690207]</td>\n",
       "      <td>[-0.2164268827072586]</td>\n",
       "      <td>weathersit</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "   coef_lasso                 coef_lr               coef_ridge     columns\n",
       "6    0.067640    [0.6552364353084575]    [0.35015384686243833]        temp\n",
       "0    0.193429    [0.2951780426792701]     [0.2757654251364401]      season\n",
       "3    0.000000  [0.035332402181452664]   [0.033998994978248695]     weekday\n",
       "4    0.000000  [0.007286281574697547]    [0.00729342301537915]  workingday\n",
       "1    0.000000  [0.003868571561647327]     [0.0188360069554371]        mnth\n",
       "7    0.476180  [-0.02114072759985118]     [0.2804709635627412]       atemp\n",
       "2   -0.000000  [-0.03601989254948204]  [-0.033641709939015066]     holiday\n",
       "8   -0.000000  [-0.05942477581033426]   [-0.06294976734688704]         hum\n",
       "9   -0.000000  [-0.12391854742331593]   [-0.11713890245230286]   windspeed\n",
       "5   -0.127561   [-0.2256947758690207]    [-0.2164268827072586]  weathersit"
      ]
     },
     "execution_count": 72,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "mses = np.mean(lasso.mse_path_, axis = 1)\n",
    "plt.plot(np.log10(lasso.alphas_), mses) \n",
    "#plt.plot(np.log10(lasso.alphas_)*np.ones(3), [0.3, 0.4, 1.0])\n",
    "plt.xlabel('log(alpha)')\n",
    "plt.ylabel('mse')\n",
    "plt.show()    \n",
    "            \n",
    "print ('alpha is:', lasso.alpha_)\n",
    "\n",
    "# 看看各特征的权重系数，系数的绝对值大小可视为该特征的重要性\n",
    "fs = pd.DataFrame({\"columns\":list(columns), \"coef_lr\":list((lr.coef_.T)), \"coef_ridge\":list((ridge.coef_.T)), \"coef_lasso\":list((lasso.coef_.T))})\n",
    "fs.sort_values(by=['coef_lr'],ascending=False)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    ""
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3.0
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.6.4"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 0
}